<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Text I/O</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="edit68k.css" rel="stylesheet" type="text/css">
<style>
<!--
td { font-family: Verdana, Arial, Helvetica, sans-serif }
.bodyline	{ background-color: #FFFFFF; border: 1px #98AAB1 solid; }

.forumline	{ background-color: #FFFFFF; border: 2px #006699 solid; }

td.row1	{ background-color: #EFEFEF; }
.code {
	font-family: Courier, 'Courier New', sans-serif; font-size: 11px; color: #006600;
	background-color: #FAFAFA; border: #D1D7DC; border-style: solid;
	border-left-width: 1px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px
}

-->
</style>
</head>

<body class="text">
<p class="heading">Sim68K Text I/O<hr noshade></p>
<p></p>
<p>TRAP #15 is used for I/O. &nbsp;Put the task number in D0.</p>
<p>
<b>&nbsp;Task</b><table border="1" cellpadding="2" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="697" height="661">
  <tr> 
    <td width="6%" class="text"><b>&nbsp; 0</b></td>
    <td class="text">&nbsp;Display n characters of string at (A1), 
	n = D1.W (stops on NULL or max 255) with CR, LF. (see 
	task 13)</td>
  </tr>
  <tr> 
    <td width="6%" class="text"><b>&nbsp; 1</b></td>
    <td class="text">&nbsp;Display n characters of string at (A1), 
	n = D1.W 
      (max 255) without CR, LF. (see task 14)</td>
  </tr>
  <tr> 
    <td width="6%" class="text"><b>&nbsp; 2</b></td>
    <td class="text">&nbsp;Read string from keyboard and 
	store 
      at (A1), NULL (0) terminated, length returned in D1.W (max 80) </td>
  </tr>
  <tr> 
    <td width="6%" class="text"><b>&nbsp; 3</b></td>
    <td class="text">&nbsp;Display 
	signed number in D1.L in decimal 
      in smallest field. (see task 15 &amp; 20)</td>
  </tr>
  <tr> 
    <td width="6%" class="text"><b>&nbsp; 4</b></td>
    <td class="text">&nbsp;Read a number from the keyboard 
      into D1.L. </td>
  </tr>
  <tr> 
    <td width="6%" class="text"><b>&nbsp; 5</b></td>
    <td class="text">&nbsp;Read single character from 
	the keyboard into D1.B. </td>
  </tr>
  <tr> 
    <td width="6%" class="text"><b>&nbsp; 6</b></td>
    <td class="text">&nbsp;Display single character in 
      D1.B.&nbsp; </td>
  </tr>
  <tr> 
    <td width="6%" class="text"><b>&nbsp; 7</b></td>
    <td class="text"> 
	<p>&nbsp;Set D1.B to 1 if keyboard input is pending, 
	otherwise set to 0.<br>
	&nbsp;Use 
        code 5 to read pending key.</td>
  </tr>
  <tr> 
    <td width="6%" class="text"><b>&nbsp; 8</b></td>
    <td class="text">&nbsp;Return time in hundredths of 
      a second since midnight in D1.L. </td>
  </tr>
  <tr> 
    <td width="6%" class="text"><b>&nbsp; 9</b></td>
    <td class="text">&nbsp;Terminate the program. 
	(Halts the simulator)</td>
  </tr>
  <tr> 
    <td width="6%" class="text"><b>&nbsp;10</b></td>
    <td class="text"> 
      <p> 
        &nbsp;Print the NULL 
		terminated string at (A1) to the default printer. (Not Teesside 
		compatible.)<br>
        &nbsp;(Always send a Form Feed 
		character to end printing. See below.)</p></td>
  </tr>
  <tr> 
    <td width="6%" class="text"><b>&nbsp;11</b></td>
    <td class="text"> 
      <p>
		&nbsp;Cursor Position,&nbsp;Set/Get or Clear Screen<br>
&nbsp;Set cursor position:<br>
		&nbsp;&nbsp;&nbsp; 
        The high byte of D1.W holds the COL number (0-255),&nbsp;&nbsp;<br>
		&nbsp;&nbsp;&nbsp; 
        The low byte holds the ROW number (0-128). <br>
		&nbsp;&nbsp;&nbsp; 
        0,0 is top left.&nbsp;<br>
		&nbsp;&nbsp;&nbsp; 
        Out of range coordinates are ignored.<br>
&nbsp;Get cursor position:<br>
&nbsp;&nbsp;&nbsp; Set D1.W to $00FF<br>
&nbsp;&nbsp;&nbsp; Returns COL number, ROW number in high and low byte of D1.W 
		respectively.&nbsp;<br>
		&nbsp;Clear 
        Screen : Set D1.W to $FF00. <br>
&nbsp;(<a href="graphics.htm">Task 95</a> supports exact pixel placement of 
		text)</p></td>
  </tr>
  <tr> 
    <td width="6%" class="text"><b>&nbsp;12</b></td>
    <td class="text"> 
      <p>
		&nbsp;Keyboard 
        Echo. 
      <br>
		&nbsp;&nbsp;&nbsp; 
        D1.B = 0 to turn off keyboard echo.
      <br>
		&nbsp;&nbsp;&nbsp; 
        D1.B = non zero to enable it (default). 
      <br>
		&nbsp;&nbsp;&nbsp; 
        Echo is restored on 'Reset' or when a new file is loaded.</td>
  </tr>
  <tr> 
    <td width="6%" class="text"><b>&nbsp;13</b></td>
    <td class="text">
	<p>&nbsp;Display the NULL terminated 
      string at (A1) with CR, LF.</td>
  </tr>
  <tr> 
    <td width="6%" class="text"><b>&nbsp;14</b></td>
    <td class="text">
	<p>&nbsp;Display the NULL terminated 
      string at (A1) without CR, LF.</td>
  </tr>
  <tr> 
    <td width="6%" class="text"><b>&nbsp;15</b></td>
    <td class="text"> 
      <p>&nbsp;Display 
        the unsigned number in D1.L converted to number base (2 through 36) contained 
        in D2.B. <br>
		&nbsp;&nbsp;&nbsp; 
        For example, to display D1.L in base16 put 16 in D2.B<br>
        &nbsp;Values of D2.B outside the range 2 to 36 inclusive are ignored.</p></td>
  </tr>
  <tr>
    <td width="6%" class="text"><b>&nbsp;16</b></td>
    <td class="text">
	<p>&nbsp;Adjust display properties<br> 
      &nbsp;&nbsp;&nbsp; D1.B = 0 to turn off the display of the input prompt.<br> 
      &nbsp;&nbsp;&nbsp; D1.B = 1 to turn on the display of the input prompt. 
	(default)<br>
&nbsp;&nbsp;&nbsp; D1.B = 2 do not display a line feed when Enter pressed 
	during Trap task #2 input <br>
	&nbsp; &nbsp; D1.B = 3 display a line feed when Enter key pressed during Trap task #2 
	input (default) <br>
	&nbsp;Other values of D1 reserved for future use.<br> &nbsp;Input prompt 
      display is enabled by default and by 'Reset' or when a new file is loaded.</td>
  </tr>
	<tr>
    <td width="6%" class="text"><b>&nbsp;17</b></td>
    <td class="text"> 
      <p>&nbsp;Combination 
		of Trap codes 14 &amp; 3. <br>
		&nbsp;Display 
		the NULL terminated string at (A1) without CR, LF then<br>
		&nbsp;Display 
		the decimal number in D1.L.</p></td>
  </tr>
  <tr>
    <td width="6%" class="text"><b>&nbsp;18</b></td>
    <td class="text">
	<p>&nbsp;Combination of Trap codes 14 
	&amp; 4. <br>
&nbsp;Display the NULL terminated string at (A1) without CR, LF then<br>
&nbsp;Read a number from the keyboard into D1.L.</td>
  </tr>
	<tr>
    <td width="6%" class="text"><b>&nbsp;19</b></td>
    <td class="text">
	<p>&nbsp;Returns current state of up to 4 
	specified keys or returns key scan code.<br>
&nbsp; Pre: D1.L = four 1-byte <a href="keyCodes.htm">key codes</a><br>
&nbsp; Post: D1.L contains four 1-byte Booleans. <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $FF = corresponding key is pressed, $00 = corresponding key 
	not pressed.<br>
	&nbsp; Pre: D1.L = $00000000<br>
&nbsp; Post: D1.L upper word contains key code of last key up. (<font color="#800000">Sim68K 
	v4.7.3 and newer)</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; D1.L lower word 
	contains key code of last key down.</td>
  </tr>
	<tr>
    <td width="6%" class="text"><b>&nbsp;20</b></td>
    <td class="text">
	<p>&nbsp;Display 
	signed number in D1.L in decimal in field D2.B columns wide.</td>
  </tr>
	<tr>
    <td width="6%" class="text"><b>&nbsp;21</b></td>
    <td class="text">
	<p>&nbsp;Set font properties where:<br>
&nbsp;&nbsp;&nbsp; D1.L is color as 0x00BBGGRR<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BB is amount of blue from 0x00 to 
	0xFF<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GG is amount of green from 0x00 to 
	0xFF<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RR is amount of red from 0x00 to 0xFF<br>
&nbsp;&nbsp;&nbsp; D2.L<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Low word is style by bits 0 = off, 1 
	= on<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bit0 is Bold<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bit1 is 
	Italic<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bit2 is 
	Underline<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bit3 is 
	StrikeOut<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; High word (low byte) is Size in 
	points (High word = 0, keep current font)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 8, 9, 10, 11, 
	12, 14, 16, 18 (not all sizes are valid for all fonts)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Font sizes in 
	multiples of valid sizes ( size * n) results in a scaled appearance. For 
	example:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; in Fixedsys 
	font sizes of 9*2, 9*3, ..9*n will result in larger characters but the 
	characters will have<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pixelated 
	edges.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; High word (high byte) is Font<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1 is Fixedsys 
	(valid sizes: 9)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2 is Courier 
	(valid sizes: 10, 12, 15)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3 is Courier 
	New (valid sizes 8,9,10,11,12,14,16,18)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4 is Lucida 
	Console (valid sizes 8,9,10,11,12,14,16,18)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5 is Lucida 
	Sans Typewriter (valid sizes 8,9,10,11,12,14,16,18)<br>
&nbsp;&nbsp;&nbsp; Example: D2.L = $01090005 is Fixedsys, 9 point, Bold 
	Underline</td>
  </tr>
	<tr>
    <td width="6%" class="text"><b>&nbsp;22</b></td>
    <td class="text">
	&nbsp;Read char at Row,Col of text screen.<br>
&nbsp; Pre: D1.L = High 16 bits = Row<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
	Low 16 bits = Col<br>
&nbsp; Post: D1.B contains ASCII code of character.</td>
  		</tr>
		<tr>
    <td width="6%" class="text"><b>&nbsp;23</b></td>
    <td class="text">
	&nbsp;Delay n/100 of a second<br>
&nbsp; Pre: D1.L = n as unsigned number 0 through $FFFFFFFF<br>
&nbsp; Use Delay in program loops to reduce the CPU utilization of Sim68K.&nbsp; </td>
  			</tr>
		<tr>
    <td width="6%" class="text"><b>&nbsp;24</b></td>
    <td class="text">
	&nbsp;Text I/O control<br>
&nbsp; Pre: D1.L = 0, Enable simulator shortcut keys. (default)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; D1.L = 1, Disable simulator 
	shortcut keys. <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
	All key codes are made available for 68000 program read using task 19.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; D1.L = all other values 
	reserved.<br>
&nbsp; Shortcuts are restored by Rewind or Reload. </td>
  			</tr>
</table>
Task numbers 0 - 9 and 11 - 12 are compatible with the Teesside simulator.<br>
<br>
The following control characters are supported. The labels shown (BEL, BS, HT, 
etc.) are not predefined in EASy68K. Placing the code in your program will 
equate the labels with the control characters.<p class="text2">BEL EQU&nbsp; $07&nbsp;&nbsp; 
Bell<br>
BS&nbsp; 
EQU&nbsp; $08&nbsp;&nbsp; Backspace<br>
HT&nbsp; EQU&nbsp; $09&nbsp;&nbsp; Tab (horizontal 5 characters)<br>
LF&nbsp; EQU&nbsp; $0A&nbsp;&nbsp; New line (line feed)<br>
VT&nbsp; EQU&nbsp; $0B&nbsp;&nbsp; Vertical tab (4 lines)<br>
FF&nbsp; EQU&nbsp; $0C&nbsp;&nbsp; Form Feed (Always end printing with a Form 
Feed.)<br>
CR&nbsp; EQU&nbsp; $0D&nbsp;&nbsp; Carriage Return
</body>
</html>
